<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/operateTag" prefix="o"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>充值确认</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<jsp:include page="/page/head.jsp"></jsp:include>
	<script type="text/javascript">
	
		$(document).ready(function(){
		
		    $('#mgrTable').datagrid({
       			height: 500, 
		        pageSize: 20,//每页显示的记录条数，默认为10  
		        pageList: [10,15,20],//可以设置每页记录条数的列表
				nowrap: true,
        		border: true,  
				striped: true,
				collapsible: false,
				url:path+'/rechargeInfo/list.do',
				sortName: 'id',
				sortOrder: 'asc',
				remoteSort: false,
				idField:'id',
				pagination:true,
				rownumbers:true,
				toolbar:'#toolbar'
			});
		    
		    
		    
			var p = $('#mgrTable').datagrid('getPager');
			$(p).pagination({   
		        beforePageText: '第',//页数文本框前显示的汉字  
		        afterPageText: '页    共  {pages} 页',  
		        displayMsg: '当前显示  {from} - {to} 条记录   共  {total} 条记录'
		    });
			
		});
		
		function search(){
			var rechargeDateStart = $('#rechargeDateStart').datebox('getValue');
			var rechargeDateEnd = $('#rechargeDateEnd').datebox('getValue');
			var fixDateStart = $('#fixDateStart').datebox('getValue');
			var fixDateEnd = $('#fixDateEnd').datebox('getValue');
			var rechargeInfoStatus = $('#rechargeInfoStatus').val();
			$('#mgrTable').datagrid('reload',{rechargeDateStart:rechargeDateStart,rechargeDateEnd:rechargeDateEnd,fixDateStart:fixDateStart,fixDateEnd:fixDateEnd,rechargeInfoStatus:rechargeInfoStatus,isConfirmation:'confirmation'});
		}
		
		function clean(){
			$('#rechargeDateStart').datebox('setValue','');
			$('#rechargeDateEnd').datebox('setValue','');
			$('#fixDateStart').datebox('setValue','');
			$('#fixDateEnd').datebox('setValue','');
			$('#rechargeInfoStatus').attr('value','');
		}
		
		//该方法用于指定操作栏的操作
		function operate(value,rowData){
			if(rowData.status == "1"){   //如果状态为未确认
				return '<a href=\"javascript:void(0);\" onclick=\"updateRechargeInfo('+value+',2)\">确认</a> | <a href=\"javascript:void(0);\" onclick=\"updateRechargeInfo('+value+',3)\">否认</a>';
			}else{   //返回确认
				return rowData.statusName;
			}
		}
		
		function updateRechargeInfo(id,updateType){
			var submit = function (v, h, f) {
			    if (v == 'ok'){
			    	url = path +"/rechargeInfo/update.do?id="+id;
			    	url += "&updateType="+updateType;
					$.ajax({
					  url: url,
					  success: function(data) {
						   if(data == "1")
						   {
							   $('#dlg').dialog('close');	
							   $('#mgrTable').datagrid('reload');
							   $('#mgrTable').datagrid('clearSelections');
	
						   } else {
								alertBox("操作失败！");
						   }
					  }
					});
			    }
			    	
			    return true; 
			};
			
			$.jBox.confirm("确定要这样操作吗？", "提示", submit);
		}
	</script>

  </head>
  
  <body>
    <div class="right">
		<h1><b>充值确认</b><span><img src="<%=basePath %>images/right_h1bg2.jpg" width="3" height="29" /></span></h1>
		<div class="ri_main">
			<table width="97%" border="0" cellspacing="0" cellpadding="4">
			  <tr>
			    <td style="vertical-align: middle;">
			    	<label>充值时间：</label>
			    	<input id="rechargeDateStart" class="easyui-datebox" editable="false"></input>
					&nbsp;&nbsp;
					<label>到：</label>
			    	<input id="rechargeDateEnd" class="easyui-datebox" editable="false"></input>
			    	&nbsp;&nbsp;&nbsp;&nbsp;
			    	<label>充值状态：</label>
			    	<select id="rechargeInfoStatus" name="rechargeInfoStatus">
			    		<option value="">所有</option>
						<c:forEach var="dict" items="${rechargeInfoStatus}">
				   			<option value="${dict.code}">${dict.name}</option>
				   		</c:forEach>
					</select>
			    </td>
			  </tr>
			  <tr>
			    <td style="vertical-align: left;">
			    	<label>确认时间：</label>
					<input id="fixDateStart" class="easyui-datebox" editable="false"></input>
					&nbsp;&nbsp;
			    	<label>到：</label>
			    	<input id="fixDateEnd" class="easyui-datebox" editable="false"></input>
			    	<input type="button" onclick="search()" value="查询" />
			    	<input type="button" onclick="clean()" value="清空" />
			    </td>
			  </tr>
			</table>
		 	<table id="mgrTable">
		 		<thead>
		 			<tr height="20">
		 				<th field="ck" checkbox="true"></th>
						<th field="orgName" width="100">商家</th>
		 				<th field="userName" width="70">法人代表</th>
						<th field="amount" width="50">金额</th>
						<th field="score" width="50">积分</th>
						<th field="rechargeDate" width="120">充值时间</th>
						<th field="type" width="70">类型</th>
						<th field="statusName" width="60">状态</th>
						<th field="fixerName" width="70">确认人</th>
						<th field="fixDate" width="120">确认日期</th>
						<th field="id" width="80" formatter="operate">操作</th>
		 			</tr>
		 		</thead>
		 	</table>  
		</div>
	</div>
  </body>
</html>